package Test;

import domain.Student1;

import java.util.ArrayList;
import java.util.Scanner;

public class Demo11 {
    public static void main(String[] args) {
        ArrayList<Student1> list = new ArrayList<>();
      mehtod(list);
      mehtod(list);
      mehtod(list);
        System.out.println(list.get(0).getName());
    }
    public static void mehtod(ArrayList<Student1> list){
        Scanner sc = new Scanner(System.in);
        String name = sc.next();
        int age = sc.nextInt();
        Student1 stu = new Student1(name, age);
        list.add(stu);
    }

}
